import { GET_BRAND_LIST, SET_USER_INFO, GET_COMPANY_TYPES, GET_BRAND_BRANCHS, GET_TASK_TYPES, GET_PUBLIC_LIST, SET_TOKEN_INFO, GET_EXPRESS_LIST, SET_ADDRESS_BOOK, GET_ADDRESS_INFO, GET_ADDRESS_LIST, EDIT_ADDRESS_INFO, DEL_ADDRESS_BOOK } from '../utils/constants'
import { getAddressBookList } from '@/actions/common'


const init_state = {
	brands: [],
	expresses: [],
	types: [],
	tasks: [],
	branches: [],
	pubList: [],
	userInfo: {},
	tokenInfo: {},
	addressAdd: {},
	addressEdit: {},
	addressDel: {},
	addressinfo: {},
	addressList: {},
}

export default function common(state=init_state, action){
	switch(action.type){
		case SET_ADDRESS_BOOK: 
			return {
				...state,
				addressAdd: action.data
			}
		case GET_ADDRESS_INFO: 
			return {
				...state,
				addressInfo: action.data
			}
		case GET_ADDRESS_LIST: 
			return {
				...state,
				addressList: action.data
			}
		case EDIT_ADDRESS_INFO: 
			return {
				...state,
				addressEdit: action.data
			}
		case DEL_ADDRESS_BOOK: 
			return {
				...state,
				addressDel: action.data
			}
		case GET_BRAND_LIST:
			return {
				...state,
				brands: action.data
			}
		case GET_EXPRESS_LIST:
			return {
				...state,
				expresses: action.data
			}
		case GET_COMPANY_TYPES:
			return {
				...state,
				types: action.data
			}
		case GET_BRAND_BRANCHS:
			return {
				...state,
				branches: action.data
			}
		case GET_TASK_TYPES:
			return {
				...state,
				tasks: action.data
			}
		case GET_PUBLIC_LIST:
			return {
				...state,
				pubList: action.data
			}
		
		case SET_USER_INFO:
			return {
				...state,
				userInfo: action.data
			}
		case SET_TOKEN_INFO:
			return {
				...state,
				tokenInfo: action.data
			}
		default:
			return state
	}
}